package opdracht2;


public class Main {

	private static final String PATH = "C:/";
	
	public static void main(String[] arg) {

		ScanFile scan1 = new ScanFile(PATH + "bible.txt");		
		ScanFile scan2 = new ScanFile(PATH + "2bibles.txt");
		ScanFile scan3 = new ScanFile(PATH + "4bibles.txt");
		ScanFile scan4 = new ScanFile(PATH + "8bibles.txt");
		ScanFile scan5 = new ScanFile(PATH + "16bibles.txt");
		ScanFile scan6 = new ScanFile(PATH + "32bibles2.txt");
		ScanFile scan7 = new ScanFile(PATH + "64bibles.txt");
		System.out.println("1 bible");
		doTheHuffman(scan1);
//		System.out.println("2 bibles");
//		doTheHuffman(scan2);
//		System.out.println("4 bibles");
//		doTheHuffman(scan3);
//		System.out.println("8 bibles");
//		doTheHuffman(scan4);
//		System.out.println("16 bibles");
//		doTheHuffman(scan5);
//		System.out.println("32 bibles");
//		doTheHuffman(scan6);
//		System.out.println("64 bibles");
//		doTheHuffman(scan7);

	}

	public static void doTheHuffman(ScanFile s) {
		long startTime = System.currentTimeMillis();
		int[] charArray = s.parse();
		Processor p = new Processor();
		Tree tree = p.createTree(charArray);
		
		System.out.println("letter\t\tfreq\t\tcode");
		p.print(tree, new StringBuffer());
		long endTime = System.currentTimeMillis();
		System.out.println("total time: " + (endTime - startTime));
	}
	
}
